package esempi;

import java.util.*;

public class test {

	public static void main(String[] args) {
		List<String> ls = new ArrayList<String>();
		ls.add("casa");
		ls.add("volpe");
		ls.add("lupo");
		System.out.println(ls);

		Set<Integer> s1 = new HashSet<Integer>();
		s1.add(5);
		s1.add(8);
		s1.add(2);
		s1.add(3);
		System.out.println(s1);

		Iterator<String> it = ls.iterator();

		while (it.hasNext()) {
			String x = it.next();
			System.out.println("x= " + x);
			it.remove();// rimuove l' elemento ottenuto dalla next.

		}
		System.out.println(ls);

		Iterator<Integer> it1 = s1.iterator();

	}
}
